#ifndef	KERNEL_HEVAKE
#define	KERNEL_HEVAKE
#include "Thread.h"
#include "Config.h"

struct	TaskHandle
{
	TaskHandle():handle(NULL),pData(NULL){};
	TaskHandle( HANDLE h , LPVOID p ):handle(h),pData(p){}
	HANDLE	handle ;
	LPVOID	pData ;
};

class	CKernel : public CThread 
{
public:
	CKernel ();
	bool	NewTask (	fnTaskType pEntry , 
						const LPVOID pData , 
						int len , 
						int nPriority = THREAD_PRIORITY_NORMAL ) ;
	void	Run ();
	void	Stop ();
protected:
	void	Task () ;
private:
	void	Use () ;
	void	Free () ;
	
	bool	bContinue ;
	uint	uTaskNum ;
	bool	bUsed ;
	TaskHandle	hList[MAX_TASK_NUM] ;
};
extern	CKernel	kernel ;
#endif